#include<bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i(a);i<=(b);++i)
#define req(i,a,b) for(int i(a);i>=(b);--i)
#define sort stable_sort
using namespace std;
char buf[1<<23],*p1=buf,*p2=buf;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<23,stdin),p1==p2)?EOF:*p1++)
template<typename TP> inline TP read(TP &num)
{
	TP x=0;
	int f=0;
	char ch=getchar();
	while(ch<48||ch>57) f|=ch=='-',ch=getchar();
	while(48<=ch&&ch<=57) x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return num=f?-x:x;
}
template<typename ...Args> inline void read(Args &...args)
{
	(read(args),...);
}
template<typename TP> inline void write(TP x)
{
	(x<0)?(putchar('-'),x=-x):0;
	(x>9)?(write(x/10),0):0;
	putchar((x%10)^48);
}
template<typename TP> inline void writeln(TP x)
{
	write<TP>(x);
	puts("");
}
vector<int> get(string t)
{
	vector<int> pi(t.size(),0);
	rep(i,1,(int)t.size()-1)
	{
		int j=pi[i-1];
		while(j>0&&t[i]!=t[j]) j=pi[j-1];
		if(t[i]==t[j]) ++j;
		pi[i]=j;
	}
	return pi;
}
vector<array<int,26>> kmp_automaton(string s)
{
	int n=s.size();
	vector<int> pi=get(s);
	vector<array<int,26>> AM(n+1);
	rep(st,0,n) rep(ch,0,25)
	{
		if(st<n&&s[st]==ch+'a') AM[st][ch]=st+1;
		else if(st==0) AM[st][ch]=0;
		else AM[st][ch]=AM[pi[st-1]][ch];
	}
	return AM;
}
signed main()
{
	freopen("neck.in","r",stdin);
	freopen("neck.out","w",stdout);
	string s,t; cin>>s>>t;
	int n=s.size(),m=t.size();
	if(m>n) return puts("0"),0;
	auto AM=kmp_automaton(t);
	vector<int> dp1(m,-1e9),dp2(m,-1e9);
	dp1[0]=0;
	for(char ch:s)
	{
		fill(dp2.begin(),dp2.end(),-1e9);
		rep(k,0,m-1) if(dp1[k]!=-1e9)
		{
			dp2[k]=max(dp2[k],dp1[k]);
			int nk=AM[k][ch-'a'];
			if(nk<m) dp2[nk]=max(dp2[nk],dp1[k]+1);
		}
		dp1.swap(dp2);
	}
	int ans=0;
	rep(k,0,m-1) ans=max(ans,dp1[k]);
	writeln(ans);
	return 0;
}
